﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace G28BS.Models
{
    public enum GameRoomStates
    {
        // A GameRoom that has been created and is being set up.
        Waiting,
        // Created as part of tournament, can not have users added or removed.
        Fixed,
        Active,
        Finished
    }

    public class GameRoom
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int gameRoomID { get; set; }
        public string gameRoomName { get; set; }
        // Have to decide on some meaning for this.
        public GameRoomStates state { get; set; }
        // The game that this gameroom is connected to.
        public int gameID { get; set; }
        [ForeignKey("gameID")]
        public Game game { get; set; }

        public int hostUserID { get; set; }
        [ForeignKey("hostUserID")]
        public UserProfile host { get; set; }
        public DateTime dateCreated { get; set; }

        public virtual ICollection<Slot> slots { get; set; }
        public virtual ICollection<Invitation> invitations { get; set; }
    }

    public class Invitation
    {
        public int invitationId { get; set; }
        public UserProfile reciever { get; set; }
        public UserProfile sender { get; set; }
        public GameRoom invRoom { get; set; }
        public DateTime timeSent { get; set; }
        public DateTime timeAnswered { get; set; }
        public int state { get; set; }
    }
}